<template>
	<view>
		<view class="baby-tab">
			<view class="baby">
				<view class="Text">
					{{info.real_name}}:
					{{info.age_text}}
				</view>
			</view>
			<view class="baby-chlik">
				<view class="button" @click="recordRouter()">
					添加记录
				</view>
				<view class="button" @click="babyRouter()">
					编辑信息
				</view>
			</view>
		</view>
		<view class="nav acea-row row-around">
			<view class="item" :class="orderStatus == 9 ? 'on' : ''" @click="statusClick(9)">
				<view>{{$t(`记录列表`)}}</view>
			</view>
			<view class="item" :class="orderStatus == 0 ? 'on' : ''" @click="statusClick(0)">
				<view>{{$t(`身高曲线`)}}</view>
			</view>
			<view class="item" :class="orderStatus == 1 ? 'on' : ''" @click="statusClick(1)">
				<view>{{$t(`体重曲线`)}}</view>
			</view>
			<view class="item" :class="orderStatus == 2 ? 'on' : ''" @click="statusClick(2)">
				<view>{{$t(`头围曲线`)}}</view>
			</view>
			<!-- <view class="item" :class="orderStatus == 4 ? 'on' : ''" @click="statusClick(4)">
				<view>{{$t(`BMI曲线`)}}</view>
			</view> -->
		</view>
		
		
		<!-- 第一个曲线 -->
		<view v-if="uCharsState">
			<view class="charts-box" v-if="orderStatus != 9">
				<Uchars
				type="tline"
				:opts="opts"
				:chartData="chartData"
				:ontouch="true"
				 tooltipFormat="tooltipDemo1"
				>
				</Uchars>
			 </view>
			 <view class="proportion country" v-if="orderStatus != 9">
			 	根据2005年中国九市儿童体格发育调查数据研究制定，参考文献：中华儿科杂志，2009年3期
			 </view>
			 <view class="proportion" v-if="orderStatus != 9">
			 	{{infoChars.field_name}}({{infoChars.y_unit_name}}/{{infoChars.x_unit_name}})
			 </view>
			 <view class="amplify-css" v-if="orderStatus != 9" @click="amplifyChilk(opts,chartData.series,infoChars)">
				 <text>放大查看</text>
			 </view>
			 <view class="help" v-if="orderStatus != 9" @click="helpChilk(infoChars.article_cate_id)">
			 	帮助指南
			 </view>
		</view>
		<!-- 第二个曲线 -->
		<view v-if="uCharsState1">
			<view class="charts-box" v-if="orderStatus != 9">
				<Uchars
				type="tline"
				:opts="opts1"
				:chartData="chartData1"
				:ontouch="true"
				 tooltipFormat="tooltipDemo1"
				>
				</Uchars>
			 </view>
			 <view class="proportion country" v-if="orderStatus != 9">
			 	根据2005年中国九市儿童体格发育调查数据研究制定，参考文献：中华儿科杂志，2009年3期
			 </view>
			 <view class="proportion" v-if="orderStatus != 9">
			 	{{infoChars1.field_name}}({{infoChars1.y_unit_name}}/{{infoChars1.x_unit_name}})
			 </view>
			 <view class="amplify-css" v-if="orderStatus != 9" @click="amplifyChilk(opts1,chartData1.series,infoChars1)">
			 	<text>放大查看</text>
			 </view>
			 <view class="help" v-if="orderStatus != 9" @click="helpChilk(infoChars1.article_cate_id)">
			 	帮助指南
			 </view>
		</view>
		<!-- 第三个曲线 -->
		 <view v-if="uCharsState2">
		 	<view class="charts-box" v-if="orderStatus != 9">
		 		<Uchars
		 		type="tline"
		 		:opts="opts2"
		 		:chartData="chartData2"
		 		:ontouch="true"
				 tooltipFormat="tooltipDemo1"
		 		>
		 		</Uchars>
		 	 </view>
			 <view class="proportion country" v-if="orderStatus != 9">
			 	根据2005年中国九市儿童体格发育调查数据研究制定，参考文献：中华儿科杂志，2009年3期
			 </view>
		 	 <view class="proportion" v-if="orderStatus != 9">
		 	 	{{infoChars2.field_name}}({{infoChars2.y_unit_name}}/{{infoChars2.x_unit_name}})
		 	 </view>
			 <view class="amplify-css" v-if="orderStatus != 9" @click="amplifyChilk(opts2,chartData2.series,infoChars2)">
			 	<text>放大查看</text>
			 </view>
		 	 <view class="help" v-if="orderStatus != 9" @click="helpChilk(infoChars2.article_cate_id)">
		 	 	帮助指南
		 	 </view>
		 </view>
		 <!-- 第四个曲线-->
		 <view v-if="uCharsState3">
		 	<view class="charts-box" v-if="orderStatus != 9">
		 		<Uchars
		 		type="tline"
		 		:opts="opts3"
		 		:chartData="chartData3"
		 		:ontouch="true"
				 tooltipFormat="tooltipDemo1"
		 		>
		 		</Uchars>
		 	 </view>
			 <view class="proportion country" v-if="orderStatus != 9">
			 	根据2005年中国九市儿童体格发育调查数据研究制定，参考文献：中华儿科杂志，2009年3期
			 </view>
		 	 <view class="proportion" v-if="orderStatus != 9">
		 	 	{{infoChars3.field_name}}({{infoChars3.y_unit_name}}/{{infoChars3.x_unit_name}})
		 	 </view>
			 <view class="amplify-css" v-if="orderStatus != 9" @click="amplifyChilk(opts3,chartData3.series,infoChars3)">
			 	<text>放大查看</text>
			 </view>
		 	 <view class="help" v-if="orderStatus != 9" @click="helpChilk(infoChars3.article_cate_id)">
		 	 	帮助指南
		 	 </view>
		 </view>
		 
		<view class="data" v-for="(item,index) in BabyList" :key="index" @click="growDetail(item.id)" v-if="orderStatus == 9">
			<view class="baby">
				<view class="born">
				   <text class="Txt">{{formatDate(item.record_time_text)}}</text>
				   <text class="Txt">{{item.age_text}}</text>
				</view>
				<text class="status">身高评价:{{item.height_grade_label}},身高百分位:{{item.height_rate_label}}</text>
				<text class="status">体重评价:{{item.weight_grade_label}},体重百分位:{{item.weight_rate_label}}</text>
				<text class="status" v-if="item.age >= 0 & item.age <= 36">头围评价:{{item.head_grade_label}},头围百分位:{{item.head_rate_label}}</text>
				<text class="status" v-if="item.age >= 24">BMI评价:{{item.bmi_grade_label}},BMI百分位:{{item.bmi_rate_label}}</text>
			</view>
			<view class="index">
				<text class="value">身高 <text style="color: #FF8FB9;padding: 0 6rpx;">{{Numfix(item.height)}}</text> cm</text>
				<text class="value">体重 <text style="color: #FF8FB9;padding: 0 6rpx;">{{item.weight}}</text> kg</text>
				<text class="value">头围 <text style="color: #FF8FB9;padding: 0 6rpx;">{{Numfix(item.head)}}</text> cm</text>
			</view>
		</view>
		<view class="loadingicon acea-row row-center-wrapper" v-if="BabyList.length > 0 && orderStatus == 9">
			<text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
			{{ loadTitle }}
		</view>
		<view v-if="BabyList.length == 0 && orderStatus == 9">
			<emptyPage v-if="!loading" :title="$t(`暂无生长记录`)"></emptyPage>
			<view class="loadingicon acea-row row-center-wrapper">
				<text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
			</view>
		</view>
	</view>
</template>

<script>
	import Uchars from './qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue'
	import { BabyGenerate,SingleCurce  } from '@/api/baby.js';
	import emptyPage from '@/components/emptyPage.vue';
	export default {
		components: {
			emptyPage,
			Uchars
		},
		data() {
			return {
				/* 第一个 */
				uCharsState:false,
				infoChars:{},
				chartData: {
					series: []
				},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts: {
				padding: [25,30,0,0],
				enableScroll:false,
				dataLabel: false,
				canvas2d:true,
				enableMarkLine: true,
				legend:{
					show:true,
					position:"top"
				},
				xAxis: {
				  scrollShow:false,
				  calibration:false,
				  gridType:'dash',
				  disableGrid: false,
				  itemCount: 5,
				  splitNumber:12,
				  titlePop:'',
				  labelCount:10,
				  limit_x:'',
				},
				extra: {
				  markLine:{
					  type: "solid",
					  dashLength: 2,
					  data:[]
				  },
				  tooltip: {
					  legendShow:false
				  },
				  line: {
					type: "straight",
					width: 1,
					activeType: "solid"
				  }
				},
				yAxis: {
					showTitle:true,
				    gridType: "dash",
					dashLength: 2,
					splitNumber:10,
					data: [
					  {
						tofix:1,
						title:'',
						min: '',
						max: '',
					  }
					]
				 }
				},
				/* 第二个 */
				uCharsState1:false,
				infoChars1:{},
				chartData1: {
					series: []
				},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts1: {
				padding: [25,30,0,0],
				// enableScroll:true,
				dataLabel: false,
				canvas2d:true,
				enableMarkLine: true,
				legend:{
					show:true,
					position:"top"
				},
				xAxis: {
				  // scrollShow:true,
				  calibration:false,
				  gridType:'dash',
				  disableGrid: false,
				  itemCount: 5,
				  splitNumber:8,
				  titlePop:'',
				  limit_x:'',
				  // labelCount:10,
				},
				extra: {
				  markLine:{
					  type: "solid",
					  dashLength: 2,
					  data:[]
				  },	
				  tooltip: {
					  legendShow:false
				  },
				  line: {
					type: "straight",
					width: 1,
					activeType: "solid"
				  }
				},
				yAxis: {
					showTitle:true,
				    gridType: "dash",
					dashLength: 2,
					splitNumber:10,
					data: [
					  {
						tofix:1,
						title:'',
						min: '',
						max: '',
					  }
					]
				 }
				},
				/* 第三个 */
				uCharsState2:false,
				infoChars2:{},
				chartData2: {
					series: []
				},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts2: {
				padding: [25,30,0,0],
				// enableScroll:true,
				dataLabel: false,
				canvas2d:true,
				enableMarkLine: true,
				legend:{
					show:true,
					position:"top"
				},
				xAxis: {
				  // scrollShow:true,
				  calibration:false,
				  gridType:'dash',
				  disableGrid: false,
				  itemCount: 5,
				  splitNumber:12,
				  titlePop:'',
				  limit_x:'',
				  // labelCount:10,
				},
				extra: {
				  markLine:{
					  type: "solid",
					  dashLength: 2,
					  data:[]
				  },	
				  tooltip: {
					  legendShow:false
				  },
				  line: {
					type: "straight",
					width: 1,
					activeType: "solid"
				  }
				},
				yAxis: {
					showTitle:true,
				    gridType: "dash",
					dashLength: 2,
					splitNumber:10,
					data: [
					  {
						tofix:1,
						title:'',
						min: '',
						max: '',
					  }
					]
				 }
				},
				/* 第四个 */
				uCharsState3:false,
				infoChars3:{},
				chartData3: {
					series: []
				},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts3: {
				padding: [25,30,0,0],
				// enableScroll:true,
				dataLabel: false,
				canvas2d:true,
				enableMarkLine: true,
				legend:{
					show:true,
					position:"top"
				},
				xAxis: {
				  // scrollShow:true,
				  calibration:false,
				  gridType:'dash',
				  disableGrid: false,
				  itemCount: 5,
				  splitNumber:8,
				  titlePop:'',
				  limit_x:'',
				  // labelCount:10,
				},
				extra: {
				  markLine:{
					  type: "solid",
					  dashLength: 2,
					  data:[]
				  },	
				  tooltip: {
					  legendShow:false
				  },
				  line: {
					type: "straight",
					width: 1,
					activeType: "solid"
				  }
				},
				yAxis: {
					showTitle:true,
				    gridType: "dash",
					dashLength: 2,
					splitNumber:10,
					data: [
					  {
						tofix:1,
						title:'',
						min: '',
						max: '',
					  }
					]
				 }
				},
				
				orderStatus:9,
				loading: false, //是否加载中
				loadend: false, //是否加载完毕
				loadTitle: this.$t(`加载更多`), //提示语
				BabyList:[],
				page:1,
				limit:10,
				info:{},
			}
		},
		onLoad:function(parms){
			this.info = JSON.parse(parms.parms)
		},
		onShow:function(){
			// 获取宝宝生长记录
			this.page = 1;
			this.BabyList = [];
			this.loadend = false;
			this.babyGenerate()
		},
		onReachBottom: function() {
			this.babyGenerate()
		},
		methods: {
			amplifyChilk:function(A1,A2,A3){
				uni.navigateTo({url:'/pages/babys/amplify_uchars?opts=' + JSON.stringify(A1) + '&series=' + JSON.stringify(A2) + '&info=' + JSON.stringify(A3)})
			},
			/* 截取一位小数 */
			Numfix(num){
				let n = parseFloat(num).toFixed(1)
				return n
			},
			/* 时间格式处理 */
			formatDate:function(dateStr) {
			     // 将字符串转换为Date对象  
			    const date = new Date(dateStr);  
			    // 提取年月日并格式化为字符串  
			    const year = date.getFullYear();  
			    const month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份是从0开始的，所以要+1  
			    const day = ('0' + date.getDate()).slice(-2); // 保证是两位数  
			    // 拼接回年月日的格式 
			    return `${year}-${month}-${day}`;  
			},
			/* 宝宝信息编辑 */
			babyRouter:function(){
				uni.navigateTo({url:'/pages/babys/baby_detail?id=' + this.info.id})
			},
			/* 跳转帮助指南 */
			helpChilk:function(id){
				uni.navigateTo({url:'/pages/extension/news_list/index?id=' + id})
			},
			/* 查询曲线1 */
			queryCurve:function(statistics_type,arrType,ageType){
				let that = this;
				SingleCurce({
					baby_id:that.info.id,
					statistics_type:statistics_type,
					type:arrType,
					data_type:ageType
				}).then(res => {
			        
					that.infoChars = res.data
					that.chartData.series = []
					that.opts.yAxis.data[0].min = parseFloat(res.data.min_y) 
					that.opts.yAxis.data[0].max = parseFloat(res.data.max_y) 
					that.opts.yAxis.data[0].title = res.data.y_unit_name
					that.opts.xAxis.titlePop =  res.data.x_unit_name
					that.opts.xAxis.limit_x = res.data.limit_x
					
					/* 用户自己的记录 */
					if(res.data.user_data.length != 0){
						const user = [];  
						res.data.user_data.forEach(item => {  
						    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
						    user.push([x, y]);  
						});
						let userObj = {
							name: "我的宝宝",
							color:'#DF0029',
							data:user,
							extra:{
								line:{
									width: 4,
								}
							}
						}
						that.chartData.series.push(userObj)
					}
					
					let Color = ['#F09C42','#F3C246','#FF8FB9','#1B4F93','#511F90','#C57CAC','#00AE72','#00B2BF','#000000','#64004B']
					for (var i = 0; i < res.data.levels_name.length; i++) {
						
						if(res.data.samples_data[res.data.levels_name[i]] && res.data.levels_name[i] in res.data.samples_data){
							const processedData = [];  
							
							
							res.data.samples_data[res.data.levels_name[i]].forEach(item => {  
							    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
							    processedData.push([x, y]);  
							});
							
							let obj = {
								pointShape:'none',
								name: res.data.levels_name[i],
								color:Color[i],
								data:processedData,
							}
							
							that.chartData.series.push(obj)
						}
					}
					/* 标记线 */
					that.opts.extra.markLine.data = []
					for (var j = 0; j < res.data.levels_name.length; j++) {
						let Marker = {
							value: parseFloat(res.data.samples_data[res.data.levels_name[j]][res.data.samples_data[res.data.levels_name[j]].length - 1].y),
							lineColor: "rgba(0,0,0,0)",
							showLabel: true,
							labelAlign: "right",
							labelOffsetX: 2,
							labelFontSize:8,
							labelPadding: 1,
							labelText: res.data.levels_name[j],
							labelFontColor: Color[j],
							labelBgColor: "#FFFFFF",
							labelBgOpacity: 0
						}
						that.opts.extra.markLine.data.push(Marker)
					}
					
					
					that.uCharsState = true
					
				}).catch(err => {
					return that.$util.Tips({
						title: err
					});
				})
			},
			/* 查询曲线2 */
			queryCurve1:function(statistics_type,arrType,ageType){
				let that = this;
				SingleCurce({
					baby_id:that.info.id,
					statistics_type:statistics_type,
					type:arrType,
					data_type:ageType
				}).then(res => {
			        
					that.infoChars1 = res.data
					that.chartData1.series = []
					that.opts1.yAxis.data[0].min = parseFloat(res.data.min_y) 
					that.opts1.yAxis.data[0].max = parseFloat(res.data.max_y) 
					that.opts1.yAxis.data[0].title = res.data.y_unit_name
					that.opts1.xAxis.titlePop =  res.data.x_unit_name
					that.opts1.xAxis.limit_x = res.data.limit_x
					
					/* 用户自己的记录 */
					if(res.data.user_data.length != 0){
						const user1 = [];  
						res.data.user_data.forEach(item => {  
						    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
						    user1.push([x, y]);  
						});
						let userObj1 = {
							name: "我的宝宝",
							color:'#DF0029',
							data:user1,
							extra:{
								line:{
									width: 4,
								}
							}
						}
						that.chartData1.series.push(userObj1)
					}
					
					let Color1 = ['#F09C42','#F3C246','#FF8FB9','#1B4F93','#511F90','#C57CAC','#00AE72','#00B2BF','#000000','#64004B']
					for (var i = 0; i < res.data.levels_name.length; i++) {
						
						if(res.data.samples_data[res.data.levels_name[i]] && res.data.levels_name[i] in res.data.samples_data){
							const processedData1 = [];  
							
							
							res.data.samples_data[res.data.levels_name[i]].forEach(item => {  
							    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
							    processedData1.push([x, y]);  
							});
							
							let obj1 = {
								pointShape:'none',
								name: res.data.levels_name[i],
								color:Color1[i],
								data:processedData1
							}
							
							that.chartData1.series.push(obj1)
						}
					}
					/* 标记线 */
					that.opts1.extra.markLine.data = []
					for (var j = 0; j < res.data.levels_name.length; j++) {
						let Marker1 = {
							value: parseFloat(res.data.samples_data[res.data.levels_name[j]][res.data.samples_data[res.data.levels_name[j]].length - 1].y),
							lineColor: "rgba(0,0,0,0)",
							showLabel: true,
							labelAlign: "right",
							labelOffsetX: 2,
							labelFontSize:8,
							labelPadding: 1,
							labelText: res.data.levels_name[j],
							labelFontColor: Color1[j],
							labelBgColor: "#FFFFFF",
							labelBgOpacity: 0
						}
						that.opts1.extra.markLine.data.push(Marker1)
					}
					
					that.uCharsState1 = true
					
				}).catch(err => {
					return that.$util.Tips({
						title: err
					});
				})
			},
			/* 查询曲线3 */
			queryCurve2:function(statistics_type,arrType,ageType){
				let that = this;
				SingleCurce({
					baby_id:that.info.id,
					statistics_type:statistics_type,
					type:arrType,
					data_type:ageType
				}).then(res => {
			        
					that.infoChars2 = res.data
					that.chartData2.series = []
					that.opts2.yAxis.data[0].min = parseFloat(res.data.min_y) 
					that.opts2.yAxis.data[0].max = parseFloat(res.data.max_y) 
					that.opts2.yAxis.data[0].title = res.data.y_unit_name
					that.opts2.xAxis.titlePop =  res.data.x_unit_name
					that.opts2.xAxis.limit_x = res.data.limit_x
					
					/* 用户自己的记录 */
					if(res.data.user_data.length != 0){
						const user2 = [];  
						res.data.user_data.forEach(item => {  
						    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
						    user2.push([x, y]);  
						});
						let userObj2 = {
							name: "我的宝宝",
							color:'#DF0029',
							data:user2,
							extra:{
								line:{
									width: 4,
								}
							}
						}
						that.chartData2.series.push(userObj2)
					}
					
					let Color2 = ['#F09C42','#F3C246','#FF8FB9','#1B4F93','#511F90','#C57CAC','#00AE72','#00B2BF','#000000','#64004B']
					for (var i = 0; i < res.data.levels_name.length; i++) {
						
						if(res.data.samples_data[res.data.levels_name[i]] && res.data.levels_name[i] in res.data.samples_data){
							const processedData2 = [];  
							
							
							res.data.samples_data[res.data.levels_name[i]].forEach(item => {  
							    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
							    processedData2.push([x, y]);  
							});
							
							let obj2 = {
								pointShape:'none',
								name: res.data.levels_name[i],
								color:Color2[i],
								data:processedData2
							}
							
							that.chartData2.series.push(obj2)
						}
					}
					/* 标记线 */
					that.opts2.extra.markLine.data = []
					for (var j = 0; j < res.data.levels_name.length; j++) {
						let Marker2 = {
							value: parseFloat(res.data.samples_data[res.data.levels_name[j]][res.data.samples_data[res.data.levels_name[j]].length - 1].y),
							lineColor: "rgba(0,0,0,0)",
							showLabel: true,
							labelAlign: "right",
							labelOffsetX: 2,
							labelFontSize:8,
							labelPadding: 1,
							labelText: res.data.levels_name[j],
							labelFontColor: Color2[j],
							labelBgColor: "#FFFFFF",
							labelBgOpacity: 0
						}
						that.opts2.extra.markLine.data.push(Marker2)
					}
					
					that.uCharsState2 = true
					
				}).catch(err => {
					return that.$util.Tips({
						title: err
					});
				})
			},
			/* 查询曲线4 */
			queryCurve3:function(statistics_type,arrType,ageType){
				let that = this;
				SingleCurce({
					baby_id:that.info.id,
					statistics_type:statistics_type,
					type:arrType,
					data_type:ageType
				}).then(res => {
			        
					that.infoChars3 = res.data
					that.chartData3.series = []
					that.opts3.yAxis.data[0].min = parseFloat(res.data.min_y) 
					that.opts3.yAxis.data[0].max = parseFloat(res.data.max_y) 
					that.opts3.yAxis.data[0].title = res.data.y_unit_name
					that.opts3.xAxis.titlePop =  res.data.x_unit_name
					that.opts3.xAxis.limit_x = res.data.limit_x
					
					/* 用户自己的记录 */
					if(res.data.user_data.length != 0){
						const user3 = [];  
						res.data.user_data.forEach(item => {  
						    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
						    user3.push([x, y]);  
						});
						let userObj3 = {
							name: "我的宝宝",
							color:'#DF0029',
							data:user3,
							extra:{
								line:{
									width: 4,
								}
							}
						}
						that.chartData3.series.push(userObj3)
					}
					
					let Color3 = ['#F09C42','#F3C246','#FF8FB9','#1B4F93','#511F90','#C57CAC','#00AE72','#00B2BF','#000000','#64004B']
					for (var i = 0; i < res.data.levels_name.length; i++) {
						
						if(res.data.samples_data[res.data.levels_name[i]] && res.data.levels_name[i] in res.data.samples_data){
							const processedData3 = [];  
							
							
							res.data.samples_data[res.data.levels_name[i]].forEach(item => {  
							    const [x, y] = [parseFloat(item.x, 10), parseFloat(item.y, 10)];  
							    processedData3.push([x, y]);  
							});
							
							let obj3 = {
								pointShape:'none',
								name: res.data.levels_name[i],
								color:Color3[i],
								data:processedData3
							}
							
							that.chartData3.series.push(obj3)
						}
					}
					/* 标记线 */
					that.opts3.extra.markLine.data = []
					for (var j = 0; j < res.data.levels_name.length; j++) {
						let Marker3 = {
							value: parseFloat(res.data.samples_data[res.data.levels_name[j]][res.data.samples_data[res.data.levels_name[j]].length - 1].y),
							lineColor: "rgba(0,0,0,0)",
							showLabel: true,
							labelAlign: "right",
							labelOffsetX: 2,
							labelFontSize:8,
							labelPadding: 1,
							labelText: res.data.levels_name[j],
							labelFontColor: Color3[j],
							labelBgColor: "#FFFFFF",
							labelBgOpacity: 0
						}
						that.opts3.extra.markLine.data.push(Marker3)
					}
					
					that.uCharsState3 = true
					
				}).catch(err => {
					return that.$util.Tips({
						title: err
					});
				})
			},
			
			/* 跳转生长曲线 */
			growChars(){
				uni.navigateTo({url:'/pages/babys/baby_curve?id=' + this.info.id})
			},
			/* 跳转添加生长记录页 */
			recordRouter:function(){
				uni.navigateTo({url:'/pages/babys/growth_recoed_add?id=' + this.info.id})
			},
		    /* 跳转生长详情*/
			growDetail(id){
				uni.navigateTo({url:'/pages/babys/growth_record?id=' + id})
			},
			/**
			 * 获取宝宝生长记录
			 */
			babyGenerate:function(){
				let that = this;
				if (that.loadend) return;
				if (that.loading) return;
				that.loading = true;
				that.loadTitle = that.$t(`加载更多`);
				BabyGenerate({
					page:that.page,
					limit:that.limit,
					child_baby_id:that.info.id,
					record_time:''
				}).then(res => {
					let list = res.data.list || [];
					let loadend = list.length < that.limit;
					that.BabyList = that.$util.SplitArray(list, that.BabyList);
					that.$set(that, 'BabyList', that.BabyList);
					that.loadend = loadend;
					that.loading = false;
					that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
					that.page = that.page + 1;
				}).catch(err => {
					that.loading = false;
					that.loadTitle = that.$t(`加载更多`);
				})
			},
			/**
			 * 切换类型
			 */
			statusClick: function(status) {
				if(status == 9) {
					this.orderStatus = status;
					// 获取宝宝生长记录
					this.page = 1;
					this.BabyList = [];
					this.loadend = false;
					this.babyGenerate()
				}else {
					
					this.queryCurve(status,0,0)
					this.queryCurve1(status,0,1)
					this.queryCurve2(status,1,0)
					this.queryCurve3(status,1,1)
					this.orderStatus = status;
				}
				
			},
		}
	}
</script>

<style lang="scss">
/* 请根据实际需求修改父元素尺寸，组件自动识别宽高 */
.charts-box {
   padding: 0 0 32rpx 0;
   background: #FFFFFF;	
   width: 100%;
   height: 400px;
}
.amplify-css{
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16rpx 0 0 0;
	background: #FFFFFF;
	text{
		background: #FF8FB9;
		color: #FFFFFF;
		padding: 6rpx 14rpx;
		border-radius: 8rpx;
	}
}
.help{
	text-align: center;
	color: #3A62F1;
	padding: 12rpx 0 88rpx 0;
	background: #FFFFFF;
}
.proportion{
	padding: 0 18rpx 0 18rpx;
	text-align: center;
	width: 100%;
	background: #FFFFFF;
}
.country{
	padding: 0 36rpx 12rpx 36rpx;
	color: #FF8FB9;
}
.baby-tab{
	font-size: 28rpx;
	color: #FFFFFF;
	background: #FFFFFF;
	display: flex;
	flex-direction: column;
	width: 730rpx;
	margin: auto;
	height: 168rpx;
	border-radius: 12rpx;
	border: 4rpx solid #FF8FB9;
	.baby{
		display: flex;
		flex: 1;
		align-items: center;
		justify-content: center;
		border-radius: 8rpx 8rpx 0 0;
		background: #FF8FB9;
		.Text{
			display: flex;
			align-items: center;
			justify-content: center;
		}
		
	}
	.baby-chlik{
		display: flex;
		flex: 1;
		align-items: center;
		justify-content: space-around;
		.button{
			padding: 16rpx 100rpx;
			border-radius: 12rpx;
			background: #FF8FB9;
			color: #FFFFFF;
			font-size: 28rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
}	
.data{
	background: #FFFFFF;
	margin: 24rpx 0 0 0;
	.index{
		padding: 18rpx 0;
		display: flex;
		flex-wrap: wrap;
		.value{
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #1A1A1A;
			width: 33.3%;
			text-align: center;
		}
	}
	
	.baby{
		margin: 0 32rpx;
		padding: 18rpx 0;
		border-bottom: 1rpx solid #ececec;
		.born{
			display: flex;
			align-items: center;
			justify-content: space-between;
			.Txt{
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #A9A9A9;
			}
			
		}
		.status{
			display: block;
			padding: 8rpx 0 0 0;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #FF8FB9;
		}
	}
}	
.nav {
	background-color: #FFFFFF;
	height: 90rpx;
	margin: 0 auto 0 auto;
}

.nav .item {
	text-align: center;
	font-size: 26rpx;
	color: #282828;
	// width: 3rem;
	padding: 27rpx 0 18rpx 0;
	border-bottom: 5rpx solid transparent;
}

.nav .item.on {
	/* #ifdef H5 || MP */
	font-weight: bold;
	/* #endif */
	/* #ifdef APP-PLUS */
	color: #000;
	/* #endif */
	border-color: #FF8FB9;
}
</style>
